package com.ynb.lighterbuffer;

import java.lang.reflect.Field;

public class FieldInfo {
	private int order;
	private Field field;
	private Class<?> fieldClass;
	private FieldType fieldType;
	private Class<?> genericityType1;
	private Class<?> genericityType2;
	@SuppressWarnings("rawtypes")
	private ISchema schema;
	@SuppressWarnings("rawtypes")
	private ISchema genericitySchema1;
	@SuppressWarnings("rawtypes")
	private ISchema genericitySchema2;
	public FieldInfo(int order,Field field,FieldType fieldType,Class<?> genericityType1,Class<?> genericityType2){
		this.order=order;
		this.field=field;
		this.fieldType=fieldType;
		this.fieldClass=field.getType();
		this.genericityType1=genericityType1;
		this.genericityType2=genericityType2;
		if(fieldType==FieldType.DEFAULT){
			this.schema=SchemaPool.getSchema(field.getType());
		}
		this.genericitySchema1=SchemaPool.getSchema(genericityType1);
		this.genericitySchema2=SchemaPool.getSchema(genericityType2);
	}
	public Class<?> getFieldClass() {
		return fieldClass;
	}
	public int getOrder() {
		return order;
	}
	public Field getField() {
		return field;
	}
	@SuppressWarnings("rawtypes")
	public ISchema getGenericitySchema1() {
		return genericitySchema1;
	}
	@SuppressWarnings("rawtypes")
	public ISchema getGenericitySchema2() {
		return genericitySchema2;
	}
	public FieldType getFieldType() {
		return fieldType;
	}
	public Class<?> getGenericityType1() {
		return genericityType1;
	}
	public Class<?> getGenericityType2() {
		return genericityType2;
	}
	@SuppressWarnings("rawtypes")
	public ISchema getSchema() {
		return schema;
	}
}
